Shadow map resolution

To adjust the shadow map code to support high resolution shadow maps, you need to adjust the rendering viewport. The initial code assumes the shadow map is the same size as the render window. This does not need to be the case. Often, the shadow map will be higher resolution to reduce aliasing artifacts in the camera view.

First, set the shadow map resolution. Then, before rendering the shadow map, set the view dimensions to match the shadow map resolution. After creating the shadow map, it is time to render the scene into the normal framebuffer. The view dimensions must be set to match the window before doing this.

Use the OpenGL glViewport function to adjust the view. It takes the x,y values for the min corner and the x,y values for the max corner.

Note: the code I gave you is similar to the Render Texture code, so the render buffer is resized when the window is resized. You do not need to resize shadow maps when the window size changes, so you change how this event is handled.